/**
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 */
<template>
  <div class="app-container"> 
    <el-table
      :key="tableKey"
      :data="list"
      border
      fit
      highlight-current-row
      style="width: 100%;margin-bottom:34px;"
    >
      <el-table-column type="index" label=" " width="50" align="center" :index="table_index"></el-table-column>
      <el-table-column label="用户编号" min-width="150px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.user_id }}</span>
        </template>
      </el-table-column>
      <el-table-column label="登录名" min-width="150px" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span>{{ row.user_name }}</span>
        </template>
      </el-table-column> 
      <el-table-column label="备注" min-width="150px" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span>{{ row.log_memo }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作IP地址" min-width="150px" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span>{{ row.log_ip }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作系统" min-width="150px" :show-overflow-tooltip="true">
        <template slot-scope="{row}">
          <span>{{ row.os }}</span>
        </template>
      </el-table-column>
      <el-table-column label="浏览器" min-width="150px" :show-overflow-tooltip="true">
        <template slot-scope="{row}">
          <span>{{ row.browser }}</span>
        </template>
      </el-table-column>
      <el-table-column label="时间" min-width="150px" sortable>
        <template slot-scope="{row}">
          <span>{{ row.create_time }}</span>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.size" @pagination="getList" />
 
  </div>
</template>

<script>
import { fetchList } from '@/api/project/system/project_sys_sys_login_log'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { Loading } from 'element-ui';

export default {
  name: 'a_systema_sys_tags',
  components: { Pagination },
  filters: {
  },
  data() {
    return {
      tableKey: 0,
      list: null,
      total: 0, 
      listQuery: {
        page: 1,
        size: 20
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    table_index(index) {
      return (
        (this.listQuery.page - 1) * this.listQuery.size +
        index +
        1
      );
    },
    openFullScreen() {
        const loading = this.$loading({
          lock: true,
          text: '数据处理中',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.2)'
        }); 
        setTimeout(() => {
          loading.close();
        }, 2000);
    },
    getList() { 
      fetchList(this.listQuery).then(response => {
       this.list =response.dataArray.dataList
        this.total = response.dataArray.dataCount
      })
    }, 
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    }
  }
}
</script>